Packing Javascript, Dean-Edwards-style?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
jjeff's picture

I've been looking at the results of Javascript optimization in Drupal 6 and it appears to me to be not all that optimized. It should really just be called Javascript "concatenation" as it doesn't appear that comments or white space is removed.

I'm guessing that there were problems with double-packing of jquery.js.. Can anyone point me to the thread where this was discussed?

I'm thinking about creating a Packer module to implement Dean Edwards' Packer to try to tweak this process and experiment with ways to solve this problem for Drupal 7.

Anyone have any tips for me before I start wasting time on this? :-)

Comments

JS aggregation and

catch's picture

JS aggregation and compression was put in: http://drupal.org/node/119441
JS compression was taken out because it was breaking on valid javascript: http://drupal.org/node/183940
New drupal 6 issue to add in compression here: http://drupal.org/node/210447

As far as I know those are three primary issues dealing with this, hope it helps.

From what I have experienced

tjholowaychuk's picture

From what I have experienced / read the 'Packer' method is in fact counter productive due to the complexity to 'unpack' and evaluate the JS it is slower on the clients end.

vision media
350designs
Print Huge Edmonton Printing Services
Design Inspiration Gallery

From what I have experienced

tjholowaychuk's picture

From what I have experienced / read the 'Packer' method is in fact counter productive due to the complexity to 'unpack' and evaluate the JS it is slower on the clients end.

vision media
350designs
Print Huge Edmonton Printing Services
Design Inspiration Gallery

Yes, minifying javascript is

mfb's picture

Yes, minifying javascript is preferable to packing. Gzipped minified js is smaller than packed javascript. Packed javascript causes a delay on the client side while it is being unpacked. And packed javascript prevented IE activex activation although I guess ms finally licensed the patent so this is a moot point.

Goal: Minified gzipped JavaScript

sun's picture

100% agreed. IMO, this should be on the task list for D7:

  1. Drupal core + contrib modules should only include unpacked, unminified JavaScript code.
  2. Drupal's JavaScript aggregator should concatenate JavaScripts only.
  3. Optionally, Drupal's JavaScript aggregator may support minifying (concatenated) JavaScripts.
  4. Leave output compression to mod_deflate (which can be configured via .htaccess).

Daniel F. Kudwien
unleashed mind

Daniel F. Kudwien
netzstrategen

Also agree that scripts

yaph's picture

Also agree that scripts should not be packed. I am regularly working with a broadband connection on a fairly old and slow computer where the disadvantages of packed JS are noticeable.

--
Websites: <a href="http://www.seo-expert-blog.com" title="SEO Expert Blog>SEO-Expert-Blog.com | Torlaune.de

One of my older frameworks

tjholowaychuk's picture

One of my older frameworks requires that all JavaScripts are not packed, or minified. The compression system sends all CSS and JS through an aggregation/minification process. works really nice! Saves a good 60% and then with gzipping ontop of that its damn fast

Vision Media - Victoria BC Web Design